/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SMeterInputConverter.java
 * Created：		2016年8月30日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.notice.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.communicate.converter.UCNConverter;
import com.thor.palmmall.rest.notice.AReader;
import com.thor.palmmall.spi.notice.SReader;

/**
 * @author zcb
 *
 */
public class AReaderConverter implements Converter<SReader, AReader> {

  public static AReaderConverter getInstance() {
    if (instance == null)
      instance = new AReaderConverter();
    return instance;
  }

  private static AReaderConverter instance;

  private AReaderConverter() {
  }

  @Override
  public AReader convert(SReader source) {
    if (source == null)
      return null;

    AReader target = new AReader();

    target.setUuid(source.getUuid());
    target.setReader(UCNConverter.getInstance().convert(source.getReader()));
    target.setTime(source.getTime());
    target.setContract(UCNConverter.getInstance().convert(source.getContract()));

    return target;
  }

}
